<template>
    <div class="component-tab">
        <div @click="tabChange(1)" :class="['tab-item',active===1?'active':'']">考试试卷</div>
        <div @click="tabChange(2)" :class="['tab-item',active===2?'active':'']">训练试卷</div>
    </div>
</template>
<script>
export default {
    name: "search",
    props: {
        file: {
            type: String,
            default: null,
        },
    },

    data() {
        return {
            active: 1,
        };
    },
    methods: {
        tabChange(data) {
            if (data != this.active) {
                this.active = data;
                this.$emit("tabChange", data);
            }
        },
    },
};
</script>
<style scoped lang="scss">
.component-tab {
    width: 100%;
    height: 40px;
    background: #221828;
    display: flex;
    .tab-item {
        flex: 1;
        color: #fff;
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .active {
        color: #56baca;
    }
}
</style>
